<template>
	<view class="" style="height:100%;overflow: hidden;">


		<uv-button v-if="!sr.userinfo" text="立即登录" size="normal" @click="control_clickLogin"
			style="width: 40%;margin-top: 500rpx;margin-left: 30%;"></uv-button>

		<uv-button v-else-if="sr.userinfo.shenfen==0" text="请先申请岗位" size="normal" @click="control_clickLogin"
			style="width: 40%;margin-top: 500rpx;margin-left: 30%;"></uv-button>

		<uv-cell-group v-else>
			<uv-cell v-for="(item, index) in list" :key="index" :label="item.nickname" :title="item.title"
				:value="item.create_at" required="true" @click="goDetail2(item.id)" v-if="list.length>0">
			</uv-cell>
			
			<view v-else style="text-align: center;margin-top: 250rpx;color: lightgray;">暂无数据</view>
		</uv-cell-group>


	</view>

</template>
<script>
	import config from "@/config/config.js";
	import xcUniappUtils from '@/library/xcore/js/XcUniappUtils.js';
	import xcHttpUtils from '@/library/xcore/js/XcHttpUtils.js';
	import xcViewUtils from '@/library/xcore/js/XcViewUtils.js';
	import xcCloginUtils from '@/library/xcore/js/XcCloginUtils.js';
	import xcCWeixinMpLoginUtils from '@/library/xcore/js/XcCWeixinMpLoginUtils.js';
	import {
		xsStringUtils,
		xsDateUtils,
		xsArrayUtils
	} from 'xstack-for-javascript';

	export default {
		onPageScroll() {
			// 滚动后及时更新位置
			this.$refs.dropDown.init();
		},
		computed: {
			dropItem(name) {
				return (name) => {
					const result = {};
					const find = this.result.find(item => item.name === name);
					if (find) {
						result.label = find.label;
						result.value = find.value;
					} else {
						result.label = this[name].label;
						result.value = this[name].value;
					}
					return result;
				}
			},
			// 获取当前下拉筛选项
			currentDropItem() {
				return this[this.activeName];
			}
		},
		data() {
			return {
				user_id: '',
				list: [],
				config: config,
				xsStringUtils: xsStringUtils,
				xsDateUtils: xsDateUtils,
				sp: {
					id: null
				},
				sr: {
					row: [],
					userinfo: null
				},
				control: {}
			}
		},
		onLoad(options) {
			let that = this;
			that.xinit();
			this.user_id = options.user_id
		},
		onShow() {
			let that = this;
			xcUniappUtils.onShow(function() {
				that.public_show();
			});

			xcCloginUtils.getUserinfo(function(userinfo) {
				that.sr.userinfo = userinfo;

			});
			xcHttpUtils.gettijiaolist({
				user_id: this.user_id
			}, function(res2) {
				that.list = res2;
				console.log(11111, that.list)
			});
		},

		onPullDownRefresh() {
			let that = this;
			setTimeout(function() {
				that.public_show();
				uni.stopPullDownRefresh();
			}, 1000);
		},
		methods: {
			goDetail2(id) {

				uni.navigateTo({
					url: '/pages/csmwj/paperDetail?qid=' + id
				});
			},
			control_clickLogin() {

				uni.navigateTo({
					url: '/pages/xclogin/me'
				});
			},
			goDetail(id) {
				console.log(id)
				uni.navigateTo({
					url: '/pages/csmwj/paper?id=' + id
				});
			},
			xinit() {
				let that = this;

			},
			public_show() {
				let that = this;
			},
			public_reset() {
				let that = this;
				that.public_show();
			},
			control_switchLocale(locale) {
				let that = this;
				xcLangUtils.switchLocale(locale);
			}
		}
	}
</script>

<style lang="scss">

</style>